Count frequency of words in a given file